home *** CD-ROM | disk | FTP | other *** search
- Hints and Tips
- 6.1
- • Alt characters − On upgrading from RISC-OS 2 to RISC-OS 3.1, I thought
- I had lost my ‘×’ character. I eventually found that it had moved from
- <alt-,> to <shift-alt-,>. (Even on RISC-OS 3.0 on the A5000 it is still
- <alt-,>.) So I investigated all the possible ALTernatives(!). Here are
- all the ALT characters I found. They are laid out in QWERTY order but
- where no special character appeared, the key is not included in the
- list.
- 6.1
- key ALT shift ALT
- 6.1
- ` ¬ °
- 6.1
- 1 ¹ ¡
- 6.1
- 2 ²
- 6.1
- 3 ³
- 6.1
- 4 ¼
- 6.1
- 5 ½
- 6.1
- 6 ¾
- 6.1
- 9 ±
- 6.1
- r ¶ ®
- 6.1
- y ¥
- 6.1
- o ø Ø
- 6.1
- p þ Þ
- 6.1
- \ ¦
- 6.1
- a æ Æ
- 6.1
- s ß §
- 6.1
- d ð Ð
- 6.1
- f ª
- 6.1
- z «
- 6.1
- x »
- 6.1
- c ¢ ©
- 6.1
- m µ º
- 6.1
- , ×
- 6.1
- . ÷
- 6.1
- / ¿
- 6.1
- I think that is all there is, but if anyone finds any more, let us know.
- Ed.
- 6.1
- • Annual service kit − In answer to Paul’s comment about hard drives in
- Archive 5.12, p.8, I’d like to sing the praises of the Alarm application
- (on one of the support disks or in ROM on RISC-OS 3). (You will see the
- link if you read on! Ed)
- 6.1
- I, too, would have forgotten completely about the annual replacement of
- filter and batteries, but for this application (which, thanks to my Boot
- file, always resides on the iconbar): When my machine was a year old,
- Alarm reminded me of this fact in no uncertain terms, (‘urgent’ alarm,
- repeating every hour), so there was very little chance of overlooking
- this necessary bit of maintenance. Jochen Konietzko, Köln, Germany.
- 6.1
- • Apple Laser Writer II NT − Here is some information for anyone wanting
- to make a cable link from an Archimedes to an Apple Laser Writer II NT.
- The connections are as follows...
- 6.1
- Archimedes LaserWriter II NT
- 6.1
- Pin Pin
- 6.1
- 2 (RXD) −−−− 3 (TXD)
- 6.1
- 3 (TXD) −−−− 2 (RXD)
- 6.1
- 5 (0V) −−−− 7 (0V)
- 6.1
- 6 (DSR) −−−− 20 (DTR)
- 6.1
- The Archimedes pins DCD (1), DTR (4) and CTS (8) are all linked
- together.
- 6.1
- When using a RISC-OS printer driver you should choose the Serial
- connection with 9600 baud rate, 8 data bits, no parity and 1 stop bit.
- XOn/XOff protocol should also be used.
- 6.1
- • DDE Pascal − Some would-be users of DDE !Pascal (on Careware 17) will
- have discovered that it won’t function in Computer Concepts’ Compressed
- Filing System (CFS), where it generates the error ‘Special field not
- allowed in filesystem prefix to OS_CLI’. This means that the command
- line interpreter, which is invoked to run the Pascal tool, objects to
- some pathname which begins with the prefix ‘CFS#’. The offending
- pathname turns out to be the <Pascal$Dir>.Pascal, as assigned into
- Alias$Pascal by the !Run file with the apparent function of enabling the
- compiler to be located in the application directory. The remedy is to
- comment out the line which assigns Alias$Pascal and move the compiler
- (i.e. <Pascal$Dir>.Pascal) to your library. This brings the configura
- tion into line with that of the C compiler and other DDE tools and
- causes ‘*Pascal’ commands to be serviced by default from the current
- library without any explicit reference to a filesystem. Mike Kinghan,
- Oxford
- 6.1
- • DDE Pascal (Careware 17) − The release of the public-domain Norcroft
- Pascal compiler for the Archimedes is potentially extremely useful,
- since, although ISO-Pascal is very good, it does not interface well with
- the operating system. More seriously, programs compiled with ISO-Pascal
- do not interface well either.
- 6.1
- The Norcroft system is easy to use and install and does everything that
- is claimed of it. Unfortunately, users should be aware of some problems,
- especially since Acorn obviously does not wish to maintain the product.
- 6.1
- I have some extra severe tests for Pascal, which I have used to test the
- compiler. This shows that the compiler has some errors in the evaluation
- of set expressions: the following program failed (printing True rather
- than False):
- 6.1
- {4 5 6 4 0 3 3000 }
- 6.1
- {the parameters from the full test which failed. }
- 6.1
- program test (output);
- 6.1
- const
- 6.1
- ten = 10;
- 6.1
- var
- 6.1
- i: 1..ten;
- 6.1
- begin
- 6.1
- i := 11; (compilation error here?)
- 6.1
- i := ten + 1; (compilation error here?)
- 6.1
- writeln(‘Error not detected‘) ;
- 6.1
- end.
- 6.1
- The first error is caught at compile-time by almost all Pascal com
- pilers, including ISO-Pascal. The second error is caught by almost all
- compilers at run-time, and a few at compile-time.
- 6.1
- When using the quit option in the Pascal menu, the system still allows
- command line usage of Norcroft Pascal, although the icon is removed.
- 6.1
- The final significant problem is that programs written in ISO-Pascal do
- not necessarily compile without the ISO option being set. This is
- annoying, since many programs will wish to use some extensions. I don’t
- know of any other Pascal compiler for which the extension option means
- less (in some cases). Brian Wichmann, NPL.
- 6.1
- • Directory size − Regarding the issue on directory sizes, etc in the
- hints & tips section, there are a few other points...
- 6.1
- RISC-OS 2 has some problems with certain combinations of disk size and
- allocation unit, so beware. The problem usually causes the machine to
- hang when entering a directory. I have only experienced this using large
- allocation units on small disks.
- 6.1
- The fact that a new dir appears to take 38Kb isn’t the whole story, as I
- believe that there is a facility for small files within a directory to
- use some of the ‘wasted’ space. However, if you tend to have lots of
- directories with few files, space does tend to get wasted.
- 6.1
- The best solution as far as both disk, space and speed is concerned is
- to use D format, which uses the ‘correct’ amount of space for direc
- tories and hardly anything for the map. (Remember that there are two
- copies of the map in E format.) D format disks are also MUCH easier to
- recover files from if the root directory or map gets corrupted and files
- can never be fragmented (which slows down access). The only disadvantage
- is the occasional need to compact but I find this a small price to pay.
- I would only recommend E format for non-technical users.
- 6.1
- The same issues will apply to all FireCore based filling systems such as
- IDE, etc. Mike Harrison
- 6.1
- • Impression/Squirrel − CC’s !Importer (also in their Business Supple
- ment) is supplied by Digital Services with Squirrel. Here is some
- experience that might help other people.
- 6.1
- Using Squirrel, I created a database with 22 fields. I then tried to
- mail merge the resultant report CSV file using !Importer. I got an error
- message saying ‘Subscript out of range (Code 6150).’ After some hours of
- fiddling, I eventually found that if I reduced the number of fields in
- the CSV file to 16, !Importer worked OK. Nick Horn, Thetford.
- 6.1
- • Second internal hard drive in an A410/1 − I fitted a 40Mb ST506 hard
- drive to my A410, thinking it would be more than adequate. However, with
- the acquisition of the PC Emulator and the formation of a 10Mb DOS
- partition, I was rapidly running out of room. I subsequently purchased a
- second hand 20Mb ST506 drive, which I decided to fit internally rather
- than buy a p.s.u., case and fan. I thought of making some mounting
- brackets but, having seen an advert for a SPACE kit from PRES which
- included brackets and all the leads, I changed my mind and went for
- that. Price was £38.72 inc VAT. The work involved was to:
- 6.1
- 1) Remove top two podule blanking plates.
- 6.1
- 2) Fit metal brackets to drive using screws supplied.
- 6.1
- 3) Remove the 34 way data cable and replace it with the one supplied,
- connecting it to the existing drive and mother board (SK11), leaving
- spare connector to connect to the second drive later.
- 6.1
- 4) Connect the supplied 20 way control cable to the spare connector
- (SK8) on the mother board, leaving the other end to be connected to the
- second drive later.
- 6.1
- 5) Remove the power cable from the psu and existing drive and replace
- it with the supplied cable, leaving the spare connector for the second
- drive.
- 6.1
- 6) Lead all three cables to the back of the computer and through the
- space left by removing the blanking plates and connect them to the
- second drive.
- 6.1
- 7) Attach the blanking plates to the metal brackets on the second
- drive using nuts & bolts supplied.
- 6.1
- 8) Ensure second drive is set to ‘1’ by changing the appropriate DIP
- switch or DS-Jumper.
- 6.1
- 9) Insert the drive through the back of computer until the front of
- the brackets rests on backplane connectors (psu side) and the blanking
- plates line up with the back of the computer. Screw in blanking plate
- screws.
- 6.1
- 10) Once computer is up and running it will have to be configured for
- a second hard drive.
- 6.1
- The work was very easy to carry out and the instructions supplied were
- very good. The drive then has to be formatted using Acorn’s HFORM
- program. The program had to be modified to do the ‘slow’ formatting by
- altering the following lines:
- 6.1
- 7530 REMmed out
- 6.1
- 7540 REMmed out
- 6.1
- 7550 REM removed
- 6.1
- 7560 REM remove
- 6.1
- Once this was done, the drive formatted with no problems and, using the
- PC Emulator’s configure program, I created a 19 Mb DOS partition.
- 6.1
- I would recommend this solution of gaining extra drive capacity if you
- have access to a cheap drive and do not mind losing the space of two
- half width podules. Chris Bass, Grimsby
- 6.1
- • Mah Jong from CIS − If you have recently purchased the Mah Jong game
- from Cambridge International Software, you may wish to check for the
- presence of a ‘benign’ virus. This can be done by double-clicking on the
- !MahJong game while holding the <shift> key down. Choose the ‘Display >
- Full Info’ option on the filer window. If the MemAlloc module is larger
- that 2608 bytes then your copy is infected and you should contact CIS
- directly at Unit 2a, Essex Road, London N1 3QP or telephone
- 071−226−3340.
- 6.1
- • Measuring free space − I would like to say a big thank you to all the
- people who wrote in response to my plea for help in finding a way of
- checking, from within a program, whether there is enough space for a
- file before it is saved.
- 6.1
- The most ingenious suggestion was to use the following commands:
- 6.1
- *FREE {ram:ccc }
- 6.1
- X=OPENUP(“RAM:CCC”)
- 6.1
- REPEAT B=BGET#X: UNTIL B=ASC“=”
- 6.1
- REPEAT B=BGET#X
- 6.1
- IF B>47 AND B<58 B$=B$+CHR$B
- 6.1
- UNTIL B=ASC“B”
- 6.1
- *SHUT
- 6.1
- to put the free space in the variable B$.
- 6.1
- Some people pointed me to ‘ADFS_FreeSpace’ (also RamFS_FreeSpace,
- SCSIFS_FreeSpace, etc.) which can be used with syntax such as:
- 6.1
- SYS “ADFS_FreeSpace”,Drive$ TO Free%,Largest%.
- 6.1
- The same information was given on page 7 of the Archive 5.12.
- 6.1
- Although all these answers have been very helpful, they have also taught
- me a salutary lesson, namely that you have to be very precise when
- describing your problem: because, although they have answered the
- question (and told me things that I did not know) they haven’t actually
- told me what I needed to know!
- 6.1
- What I actually want is a filing system independent way of finding out
- whether a file with any given path name can be saved. For instance, if
- the user of my program indicates (by dragging an icon to a filer window
- or typing into a save box) that he wants to save a file with the path
- name ‘XXXFS::$....Filename’ and if my program knows how long the file
- will be, I want my program to be able to find out whether the file will
- fit in the specified place, without knowing in advance whether ‘XXXFS’
- stands for ADFS or CFS or SCSIFS or RamFS or whatever. The program also
- has to work if a path is not specified and the file is simply to be
- saved to the CSD.
- 6.1
- A couple of correspondents have pointed out that there is an SWI called
- ‘FileCore_FreeSpace’ (on page 1021 of the PRM). However, in order to use
- this you have to know the ‘private word’ of the filing system in
- question and, so far as I can see, this SWI can only therefore be called
- by a filing system module, which is not much use to a mere mortal
- programmer!
- 6.1
- I still, therefore, believe that the only generalised way of doing what
- I want is to use syntax like the following :
- 6.1
- X%=OPENOUT(Filename$)
- 6.1
- SYS “XOS_Args”,6,X%,Length% TO ,,Allocated%
- 6.1
- IF Allocated% >= Length% THEN ... go ahead and save it.
- 6.1
- This is hardly elegant but it seems to work.
- 6.1
- I understand that RISC-OS 3 will include the generalised SWI that I
- want. However, this will not be much use, of course, in a program that
- is designed to work in RISC-OS 2 as well! Hugh Eagle, Horsham
- 6.1
- • Formatting numbers (continued) − Over the last two months, I have been
- following the correspondence on Basic’s number formatting ability (PRINT
- and STR$) with some interest. Has the increased size and complexity of
- RISC-OS caused the oversight of some of the slightly esoteric but very
- powerful features of BBC Basic? One such feature is the @% variable in
- Basic. The @% variable controls the format of the PRINT and STR$
- functions and much of last month’s discussions could have been settled
- by altering the @% variable so that STR$ was formatted in the same way
- as PRINT.
- 6.1
- @% is fully discussed in the manuals that accompany the computer under
- the PRINT command but I will try to give some useful pointers here. As
- with all Basic integers, the @% variable is four bytes long. When Byte 4
- (the left-most byte) is zero Basic ignores @% when using the STR$
- function (this is the default and the source of last month’s problems)
- otherwise STR$ is formatted exactly the same as PRINT. Byte 3 allows the
- choice of three different formatting types: 0 − general (the default), 1
- − exponent and 2 − fixed. Byte 2 specifies the number of digits printed
- and Byte 1 gives the print field width when you use comma separators in
- PRINT.
- 6.1
- Our problem arises from two areas: the way computers represent numbers
- and the value of @%. At this point, I think it is necessary to take an
- aside into the nature of real number representation in computers so, if
- you are only interested in how to circumvent Basic’s printing problems,
- skip to the end of this article.
- 6.1
- Common advice to novice programmers is not to use real variables unless
- you really have to. Speed and storage reasons are normally given for
- simplicity but a far more important reason is that real numbers are not
- exact in the same way as integers and they must be treated differently.
- A classic example is the problem in mathematics of dealing with two
- representations of, say, the number one: which could be 1.000... or
- 0.999.... As far as we are concerned both are the same but if we ask a
- computer whether or not they are equal, we find not. This is due to no
- fault of the computer or the programmer but the acceptance that
- computers cannot store the infinite expressions for real numbers but
- must approximate to a number of decimal places and so springs up the
- subject of numerical analysis.
- 6.1
- How then do we equate real numbers? Well, we must choose a value for a
- zero! That is a number where any number smaller than it we consider to
- be ‘as good as zero’. An example for Basic is 10−7, any smaller and the
- errors in calculations become significant. So when we want to check
- equality of two numbers a and b we use the expression (ABS(ab) < 1E-7).
- If this is true then the two numbers are ‘as good as equal’. (ABS is
- used since we are only interested in the magnitude of the difference
- between the numbers.)
- 6.1
- The second important point with numbers stored in computers is that they
- are stored in binary. Yes, of course, you all knew that but fewer people
- are aware how computers store fractions. Much like in decimal when we
- have a decimal point, computers use a binary point where the digits to
- the right of the point have place values 1/2, 1/4, 1/8, etc. In decimal
- there is a problem of representing fractions like 1/3 or 1/6 because the
- prime factors of 3 or 6 are not divisible by the factors of 10 (2, 5) so
- you get infinite decimal expansions for them. In binary, the problem is
- greater because there is only one factor of two (unlike two factors of
- ten) so even more numbers have infinite representations (this is why
- some people advocate using base 12 instead of base 10 for day to day
- life − it makes mental arithmetic so much easier). This means that
- simple decimal numbers like 0.6 have an infinite expansion in binary.
- 6.1
- What has all this got to do with printing numbers in Basic? Well, an
- appreciation of what is going on when you store numbers will help you
- avoid the pitfalls that last month’s contributors highlighted. Now that
- we are aware that innocuous looking numbers like 2.1 can have infinite
- expansions when stored in binary, it becomes clear that 2.1 × 10 may not
- equal 21 but, perhaps, 20.99999999!
- 6.1
- Is there anything that we can do about this? Yes, indeed there is. We
- can tell Basic to round off the number to nine decimal places instead of
- attempting to print 10 which extends the precision beyond the accuracy
- (in general Basic is accurate to nine decimal places unless you are
- using the floating point version where I believe 19 is the limit but not
- having a RISC-OS 3...).
- 6.1
- Now we come back to @%. At default, @% specifies 9 decimal places but it
- only affects PRINT and not STR$ which defaults to ten. To alter this,
- all we need to do is set the byte 4 flag in @% to one. Try PRINT
- STR$(0.6) and then set @% = &0100090A and try again (by the way, &90A is
- the default value for @% whereas STR$ uses &A0A if byte 4 is unset).
- 6.1
- If we want to print money then we can set @% to two decimal places by
- &0002020A (remember to set byte 4 to one if you want to use STR$). This
- has the added bonus of allowing you to print the number rounded off but
- still maintain the extra places for further calculations.
- 6.1
- I hope you can now see the power and simplicity of using @%. My only
- warning is that if you wish to use several formats in your program, then
- either save the previous @% or declare it as a local variable. Emmet
- Spier, Guildford.
- 6.1
- This subject seems to have opened up quite a debate. Emmet has agreed to
- edit any comments regarding rounding errors for us and so if your wish
- to add to the debate you should write to him directly. Emmet Spier, 6
- Parklands Place, Guildford, Surrey GU1 2PS.
- 6.1
- • PC keyboards for A4 − A word of warning − not all PC type keyboards
- work on the A4 (or all PCs for that matter!), so take the A4 to the shop
- and try before you buy! Reasonable ones can be had for about £40 at some
- computer fairs. Note that non PS/2 type keyboards (with the 5 pin DIN
- plug) can be used with an adaptor or by changing the plug. Mike
- Harrison
- 6.1
- • RISC-OS 3 DOS partitions − Because DOS filenames (including exten
- sions) are in general longer than the maximum length of a valid ADFS
- filename (10), it is not always possible to copy or move DOS files from
- hard or floppy discs directly to the ADFS.
- 6.1
- The !MultiFS utility as supplied with the PC Emulator solves this by
- allowing you to truncate the DOS filename while the translation process
- takes place. Another very useful option (which I often use when copying
- files from C programs) is to force !MultiFS to handle DOS extensions as
- (hierarchical) directories.
- 6.1
- However, when the filetype of a DOS partition on your ADFS hard disc is
- set to ‘DOSdisc’, RISC-OS 3 will display a filer window for the
- partition when you try to open the folder, while !MultiFS just ignores
- it (i.e. no :C drive on the iconbar.) This is all very nice but RISC-OS
- 3 doesn’t offer the nice name translation options mentioned above. To
- enable !MultiFS to display your DOS partitions, just set their filetype
- to ‘data’ before you start !MultiFS. Remember to use the command line
- and not the filer menu because the latter doesn’t allow you to change
- the the filetype of DOSdiscs. I inserted 3 lines for each DOS partition
- in the !MultiFS !Run file to swap between ‘DOSdisc’ and ‘data’ type
- partitions when !MultiFS is started:
- 6.1
- *Filer_CloseDir <PCe$Drive_X>
- 6.1
- *SetType <PCe$Drive_X> Data
- 6.1
- directly after setting the system variable <PCe$Drive_X>, and
- 6.1
- *SetType <PCe$Drive_X> DOSDisc
- 6.1
- at the end of the !Run file (although the comment tells us not to do
- so).
- 6.1
- Unfortunately, there are some bugs in !MultiFS: When you copy to a
- MultiFS filer window, you must ensure name translation is not set to
- hierarchical or you will end up with wildcards (‘?’) in filenames. When
- this happens you must use DOS itself to delete the file because RISC-OS
- fails to wipe those objects. Another bug appears if you shut down your
- system after using !MultiFS. This results in an error report and a task
- manager crash. Paul Groot, Holland.
- 6.1
- • Saloon Cars Deluxe − If you are having problems running Saloon Cars
- Deluxe, it may be worth knowing that you must have the Font Manager
- installed for it to run.
- 6.1
- • Shareware 44 (Fortran Friends) update − There is a small bug in the
- !Fortran77. DesktopF77 program. Line 1400 should read:
- 6.1
- 1400 IF INSTR(b$,“rror”) THEN E%+=1
- 6.1
- This allows errors in the code generator part of the compiler to be
- detected. Kate Crennell, Oxon.
- 6.1
- • Zelanites cheat − The following program provides a cheat for
- Zelanites. It stops the number of lives decreasing below 9. Steve
- Edwards, Stourbridge.
- 6.1
- 10 REM >:0.$.hints.zelcheat
- 6.1
- 20 REM Archive hints & tips section
- 6.1
- 30 REM (c) S.EDWARDS 1992
- 6.1
- 40 REM infinite lives for Zelanites
- 6.1
- 50 REM ****************************
- 6.1
- 60 REM * When you have run the program the game should *
- 6.1
- 70 REM * then be run as normal. This time when you die *
- 6.1
- 80 REM * you will have not gone down one life but up *
- 6.1
- 90 REM * to NINE lives, which stay with you for ever. *
- 6.1
- 100 REM * *
- 6.1
- 110 REM ****************************
- 6.1
- 120 :
- 6.1
- 130 DIM store% &400
- 6.1
- 140 MODE 0
- 6.1
- 150 PROCDisc_op
- 6.1
- 160 PRINT‘********FINISHED********’
- 6.1
- 170 PRINT
- 6.1
- 180 PRINT‘****NOW GET BLASTING****’
- 6.1
- 190 END
- 6.1
- 200 :
- 6.1
- 210 DEF PROCDisc_op
- 6.1
- 220 PRINT ‘Put !ZELANITE disc into drive 0’
- 6.1
- 230 PRINT ‘ and press a key.’
- 6.1
- 240 A=GET
- 6.1
- 250 PRINT ‘Loading sector information’
- 6.1
- 260 SYS ‘ADFS_DiscOp’,0,1,&50400, store%,&400
- 6.1
- 270 store%?&67=&6A:REM Original code =&2A
- 6.1
- 280 INPUT‘Are you are ready to make the change ?’;A$
- 6.1
- 290 IF LEFT$(A$,1)=‘N’ OR LEFT$(A$,1)=‘n’ THEN END
- 6.1
- 300 IF LEFT$(A$,1)=‘Y’ OR LEFT$(A$,1)=‘y’ THEN
- 6.1
- 310 PRINT‘Saving cheat back to disk’
- 6.1
- 320 SYS ‘ADFS_DiscOp’,0,2,&50400, store%,&400
- 6.1
- 330 ENDIF
- 6.1
- 340 ENDPROC A
-